﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//importamos
using System.Data.Entity.ModelConfiguration;
using CredisysTriunfadores.BusinessEntites.Ahorros;
using System.ComponentModel.DataAnnotations.Schema; //el DatabaseGeneratedOption

namespace CredisysTriunfadores.Repository.Mapping
{
    public class AhorroMap:EntityTypeConfiguration<Ahorro>
    {
        public AhorroMap()
        {
            //clave primaria y que sea autoincrementable
            this.HasKey(ah => ah.Id);
            this.Property(ah => ah.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            //propiedades
            this.Property(ah => ah.Cantidad)
                .HasColumnType("decimal")
                .HasPrecision(9, 2)
                .IsRequired();
        }
    }
}
